<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>mongodb笔记(一) 安装启动mongodb | 净土</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="数据库， mongodb 安装，mongodb 启动，mongodb install">
<meta property="og:type" content="article">
<meta property="og:title" content="mongodb笔记(一) 安装启动mongodb">
<meta property="og:url" content="http://howiefh.github.io/2014/04/26/mongodb-note-1-install-mongodb/index.html">
<meta property="og:site_name" content="净土">
<meta property="og:description" content="数据库， mongodb 安装，mongodb 启动，mongodb install">
<meta property="og:updated_time" content="2014-12-24T07:47:58.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="mongodb笔记(一) 安装启动mongodb">
<meta name="twitter:description" content="数据库， mongodb 安装，mongodb 启动，mongodb install">
  
    <link rel="alternative" href="/atom.xml" title="净土" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.ico">
  
  <link href="http://fonts.useso.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css" type="text/css">
  
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-40492061-1', 'auto');
ga('send', 'pageview');

</script>


  
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?56d2899c5e919fbf4a7b00de5d1c31dd";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">净土</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">乐不在外而在心，心以为乐，则是境皆乐；心以为苦，则无境不苦。</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-github-link" class="nav-icon" href="https://github.com/howiefh" title="Github" target="_blank"></a>
        
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed" target="_blank"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://howiefh.github.io"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main"><article id="post-mongodb-note-1-install-mongodb" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    
<a href="/2014/04/26/mongodb-note-1-install-mongodb/" class="article-date">
  <time datetime="2014-04-26T14:26:20.000Z" itemprop="datePublished">2014-04-26</time>
</a>


    
  <div class="article-category">
    <a class="article-category-link" href="/categories/Database/">Database</a>►<a class="article-category-link" href="/categories/Database/MongoDB/">MongoDB</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      mongodb笔记(一) 安装启动mongodb
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
		
		<div id="toc" class="toc-article">
			<h2 class="toc-title"><span>Contents</span></h2>
		
			<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Windows下安装"><span class="toc-number">1.</span> <span class="toc-text">Windows下安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装"><span class="toc-number">1.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#运行mongodb"><span class="toc-number">1.2.</span> <span class="toc-text">运行mongodb</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#添加mongodb为windows服务"><span class="toc-number">1.3.</span> <span class="toc-text">添加mongodb为windows服务</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux下安装"><span class="toc-number">2.</span> <span class="toc-text">Linux下安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装-1"><span class="toc-number">2.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#运行mongodb-1"><span class="toc-number">2.2.</span> <span class="toc-text">运行mongodb</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#参数"><span class="toc-number">3.</span> <span class="toc-text">参数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#问题处理"><span class="toc-number">4.</span> <span class="toc-text">问题处理</span></a></li></ol>
		
		</div>
		
        <h2 id="Windows下安装">Windows下安装</h2><blockquote>
<p>从 2.2 开始已经不再支持 Windows XP。<br>Windows Server 2008 R2 或 Windows 7下需要安装一个补丁： <a href="http://support.microsoft.com/kb/2731284" target="_blank" rel="external">DOS 错误代码时使用 FlushViewOfFile() 函数，在 Windows 7 中，或在 Windows Server 2008 R2 中清除内存内存映射文件</a></p>
</blockquote>
<a id="more"></a>
<h3 id="安装">安装</h3><ul>
<li><p>下载</p>
<p>  从 <a href="http://www.mongodb.org/downloads" target="_blank" rel="external">http://www.mongodb.org/downloads</a> 下载你所需要的版本，可以通过下面的命令判断你需要安装的版本</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wmic os get osarchitecture</span><br></pre></td></tr></table></figure>
</li>
<li><p>解压缩文件</p>
<p>  将下载的压缩包解压到一个目录中，例如 D:\PortableApps\mongodb\</p>
</li>
<li><p>设置系统变量</p>
<p>  为了在控制台执行命令方便可以设置系统环境变量  </p>
<p>  计算机—属性—高级系统配置—环境变量—系统变量中的path,加上<code>;D:\PortableApps\mongodb\bin</code> ，注意前面的分号。</p>
</li>
</ul>
<h3 id="运行mongodb">运行mongodb</h3><blockquote>
<p>不要让mongod.exe运行在没有身份验证设置的“安全模式”的公网上。MongoDB被设计运行在可信任的环境中，数据库默认情况下没有启用“安全模式”。</p>
</blockquote>
<ul>
<li><p>配置 mongodb 运行环境</p>
<p>  配置mongodb的数据库目录，mongodb默认的存放数据的目录是<code>\data\db</code>。如果你的mongodb在D盘，那么<code>\data\db</code>就在你的D盘根目录下，即<code>D:\data\db</code>，此目录需要自己创建，mongodb不会帮你创建，可以使用下面命令创建。</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">md \data\db</span><br></pre></td></tr></table></figure>
<p>  也可以用 <code>--dbpath</code> 参数来指定mongodb的运行数据目录。如果你的目录路径中包含空格，记得在路径两边加引号。</p>
</li>
<li><p>启动mongodb服务</p>
<p>  运行下面命令</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd D:\PortableApps\mongodb&#10;bin\mongod --dbpath data\db</span><br></pre></td></tr></table></figure>
<p>  如果有”waiting for connections”的提示，说明你已经运行成功了，请选择私有网络运行mongodb，比如家庭或工作网络。  </p>
<p>  mongod还会启动一个非常基本的HTTP服务器，使用端口28017,可以访问<a href="http://localhost:28017" target="_blank" rel="external">http://localhost:28017</a> 来获取数据库的管理信息。要更好利用好管理接口，需要用—rest选项开启REST支持。可以通过—nohttpinterface关闭管理接口。</p>
</li>
<li><p>连接mongodb</p>
<p>  运行下面命令连接到mongodb</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd D:\PortableApps\mongodb\bin&#10;mongo</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="添加mongodb为windows服务">添加mongodb为windows服务</h3><ul>
<li><p>需要以管理员权限启动命令行窗口</p>
<p>  <strong>Windows 7 / Vista / Server 2008 (and R2)</strong> 按<code>Win + R</code>，输入<code>cmd</code>，再按<code>Ctrl + Shift + Enter</code>  </p>
<p>  <strong>Windows 8</strong> 按<code>Win + X</code>，再按<code>A</code></p>
</li>
<li><p>创建目录</p>
<p>  为数据库文件和日志文件创建目录</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">md D:\portableapps\mongodb\data\db&#10;md D:\portableapps\mongodb\data\log</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建配置文件</p>
<p>  配置文件中必须包含有效的logpath</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">echo logpath=D:\PortableApps\mongodb\data\log\mongod.log&#62; &#34;D:\portableapps\mongodb\mongod.cfg&#34;&#10;echo dbpath=D:\PortableApps\mongodb\data\db&#62;&#62; &#34;D:\portableapps\mongodb\mongod.cfg&#34;&#10;echo fork=true&#62;&#62; &#34;D:\portableapps\mongodb\mongod.cfg&#34;</span><br></pre></td></tr></table></figure>
<p>  配置文件中#开头为注释，配置项形式<code>选项=值</code>，对于命令中如<code>--fork</code>这样的选项，其值为true</p>
</li>
</ul>
<ul>
<li><p>添加系统服务</p>
<p>  执行下面命令，binPath需要对<code>&quot;</code>进行转义</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sc create MongoDB binPath= &#34;\&#34;D:\PortableApps\mongodb\bin\mongod.exe\&#34; --service --config=\&#34;D:\PortableApps\mongodb\mongod.cfg\&#34;&#34; DisplayName= &#34;MongoDB&#34; start= &#34;demand&#34;</span><br></pre></td></tr></table></figure>
<p>  start设置为<code>demand</code>，需要每次手动启动，可以设置为<code>auto</code>  </p>
<p>  成功后将会输出<code>[SC] CreateService 成功</code>  </p>
</li>
</ul>
<blockquote><p>sc [ServerName] create [ServiceName] [type= {own | share | kernel | filesys | rec | adapt | interacttype= {own | share}}] [start= {boot | system | auto | demand | disabled}] [error= {normal | severe | critical | ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag= {yes | no}] [depend= dependencies] [obj= {AccountName | ObjectName}] [displayname= DisplayName] [password= Password]</p>
<footer><strong>百度百科,</strong><cite><a href="http://baike.baidu.com/view/1367668.htm?fr=ala0_1_1#3" target="_blank" rel="external">baike.baidu.com/view/1367668.htm?fr=ala0_1_1#3</a></cite></footer></blockquote>
<ul>
<li>启动服务</li>
</ul>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">net start MongoDB</span><br></pre></td></tr></table></figure>
<ul>
<li><p>停止或删除服务</p>
<p>  停止服务</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">net stop MongoDB</span><br></pre></td></tr></table></figure>
<p>  先停止服务，然后删除 MongoDB 服务</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sc delete MongoDB</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="Linux下安装">Linux下安装</h2><h3 id="安装-1">安装</h3><ul>
<li><p>下载</p>
<p>  执行下面命令，下载压缩包</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -0 https://fastdl.mongodb.org/linux/mongodb-linux-i686-2.6.0.tgz</span><br></pre></td></tr></table></figure>
</li>
<li><p>解压</p>
<p>  执行下面命令解压下载好的文件</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf mongodb-linux-i686-2.6.0.tgz</span><br></pre></td></tr></table></figure>
</li>
<li><p>将解压后的目录复制到要运行mongodb的目录</p>
<p>  执行下面命令拷贝mongodb</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p /opt/mongodb&#10;cp -R -n mongodb-linux-i686-2.6.0/ /opt/mongodb</span><br></pre></td></tr></table></figure>
</li>
<li><p>确保可执行文件的在PATH变量中</p>
<p>  可以在<code>/etc/profile</code>中添加<code>PATH=/opt/mongodb/bin:$PATH</code>，也可以在<code>/usr/local/bin</code>中创建符号链接。</p>
</li>
<li><p>其它</p>
<p>  几个主流的Linux操作系统，可以分别通过它们的包管理工具安装mongodb:<a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/" target="_blank" rel="external">Red Hat</a>、<a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/" target="_blank" rel="external">Ubuntu</a>、<a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/" target="_blank" rel="external">Debian</a></p>
</li>
</ul>
<h3 id="运行mongodb-1">运行mongodb</h3><ul>
<li><p>创建数据目录</p>
<p>  默认数据库文件存放在<code>/data/db</code>下。需要自己创建目录，可以执行下面的命令</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p /data/db</span><br></pre></td></tr></table></figure>
</li>
<li><p>设置用户对数据目录的权限</p>
<p>  在运行mongod之前需要确保用户对，用户对mongodb的数据库目录有读写权限。</p>
</li>
<li><p>运行mongodb</p>
<p>  执行下面命令</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mongod</span><br></pre></td></tr></table></figure>
<p>  或者</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mongod --dbpath &#60;path to data directory&#62;</span><br></pre></td></tr></table></figure>
<p>  前者将使用默认的数据库目录<code>/data/db</code></p>
</li>
<li><p>启动脚本</p>
<p>  <a href="http://wbzyl.inf.ug.edu.pl/nosql/fedora/f16/mongod.sh" target="_blank" rel="external">http://wbzyl.inf.ug.edu.pl/nosql/fedora/f16/mongod.sh</a>  </p>
<p>  <a href="https://github.com/mongodb/mongo/blob/master/debian/init.d" target="_blank" rel="external">https://github.com/mongodb/mongo/blob/master/debian/init.d</a>  </p>
<p>  对于Debian， 在 <code>/etc/init.d/mongod</code> 中创建脚本  </p>
<p>  对于Red Hat，在 <code>/etc/rc.d/init.d/mongod</code> 中创建脚本  </p>
</li>
<li><p>停止</p>
<ol>
<li>Ctrl + C</li>
<li>kill -2 pid (SIGINT)</li>
<li>kill pid (SIGTERM)</li>
<li><code>use admin; db.shutdownServer()</code></li>
<li>db.runCommand({“shutdown”:1})</li>
</ol>
</li>
</ul>
<h2 id="参数">参数</h2><p>下表为mongodb启动的参数说明</p>
<ul>
<li>基本参数</li>
</ul>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>—port arg</td>
<td>指定服务端口号，默认端口27017</td>
</tr>
<tr>
<td>—bind_ip arg</td>
<td>绑定服务IP，若绑定127.0.0.1，则只能本机访问，不指定默认本地所有IP</td>
</tr>
<tr>
<td>—logpath arg</td>
<td>指定MongoDB日志文件，注意是指定文件不是目录</td>
</tr>
<tr>
<td>—logappend</td>
<td>使用追加的方式写日志</td>
</tr>
<tr>
<td>—dbpath arg</td>
<td>指定数据库路径</td>
</tr>
<tr>
<td>—config arg (-f arg)</td>
<td>指定配置文件</td>
</tr>
<tr>
<td>—quiet</td>
<td>安静输出</td>
</tr>
<tr>
<td>—pidfilepath arg</td>
<td>PID File 的完整路径，如果没有设置，则没有PID文件</td>
</tr>
<tr>
<td>—keyFile arg</td>
<td>集群的私钥的完整路径，只对于Replica Set 架构有效</td>
</tr>
<tr>
<td>—unixSocketPrefix arg</td>
<td>UNIX域套接字替代目录,(默认为 /tmp)</td>
</tr>
<tr>
<td>—fork</td>
<td>以守护进程的方式运行MongoDB，创建服务器进程</td>
</tr>
<tr>
<td>—auth</td>
<td>启用验证</td>
</tr>
<tr>
<td>—cpu</td>
<td>定期显示CPU的CPU利用率和iowait</td>
</tr>
<tr>
<td>—diaglog arg</td>
<td>diaglog选项 0=off 1=W 2=R 3=both 7=W+some reads</td>
</tr>
<tr>
<td>—directoryperdb</td>
<td>设置每个数据库将被保存在一个单独的目录</td>
</tr>
<tr>
<td>—journal</td>
<td>启用日志选项，MongoDB的数据操作将会写入到journal文件夹的文件里</td>
</tr>
<tr>
<td>—journalOptions arg</td>
<td>启用日志诊断选项</td>
</tr>
<tr>
<td>—ipv6</td>
<td>启用IPv6选项</td>
</tr>
<tr>
<td>—jsonp</td>
<td>允许JSONP形式通过HTTP访问（有安全影响）</td>
</tr>
<tr>
<td>—maxConns arg</td>
<td>最大同时连接数 默认2000</td>
</tr>
<tr>
<td>—noauth</td>
<td>不启用验证</td>
</tr>
<tr>
<td>—nohttpinterface</td>
<td>关闭http接口，默认关闭27018端口访问</td>
</tr>
<tr>
<td>—noprealloc</td>
<td>禁用数据文件预分配(往往影响性能)</td>
</tr>
<tr>
<td>—noscripting</td>
<td>禁用脚本引擎</td>
</tr>
<tr>
<td>—notablescan</td>
<td>不允许表扫描</td>
</tr>
<tr>
<td>—nounixsocket</td>
<td>禁用Unix套接字监听</td>
</tr>
<tr>
<td>—nssize arg (=16)</td>
<td>设置信数据库.ns文件大小(MB)</td>
</tr>
<tr>
<td>—objcheck</td>
<td>在收到客户数据,检查的有效性，</td>
</tr>
<tr>
<td>—profile arg</td>
<td>档案参数 0=off 1=slow, 2=all</td>
</tr>
<tr>
<td>—quota</td>
<td>限制每个数据库的文件数，设置默认为8</td>
</tr>
<tr>
<td>—quotaFiles arg</td>
<td>number of files allower per db, requires —quota</td>
</tr>
<tr>
<td>—rest</td>
<td>开启简单的rest API</td>
</tr>
<tr>
<td>—repair</td>
<td>修复所有数据库run repair on all dbs</td>
</tr>
<tr>
<td>—repairpath arg</td>
<td>修复库生成的文件的目录,默认为目录名称dbpath</td>
</tr>
<tr>
<td>—slowms arg (=100)</td>
<td>value of slow for profile and console log</td>
</tr>
<tr>
<td>—smallfiles</td>
<td>使用较小的默认文件</td>
</tr>
<tr>
<td>—syncdelay arg (=60)</td>
<td>数据写入磁盘的时间秒数(0=never,不推荐)</td>
</tr>
<tr>
<td>—sysinfo</td>
<td>打印一些诊断系统信息</td>
</tr>
<tr>
<td>—upgrade</td>
<td>如果需要升级数据库</td>
</tr>
<tr>
<td>—serviceName</td>
<td>指定服务名称</td>
</tr>
<tr>
<td>—serviceDisplayNam</td>
<td>指定服务名称，有多个mongodb服务时执行。</td>
</tr>
<tr>
<td>—install</td>
<td>指定作为一个Windows服务安装。</td>
</tr>
</tbody>
</table>
<ul>
<li>Replicaton 参数</li>
</ul>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>—fastsync</td>
<td>从一个dbpath里启用从库复制服务，该dbpath的数据库是主库的快照，可用于快速启用同步</td>
</tr>
<tr>
<td>—autoresync</td>
<td>如果从库与主库同步数据差得多，自动重新同步，</td>
</tr>
<tr>
<td>—oplogSize arg</td>
<td>设置oplog的大小(MB)</td>
</tr>
</tbody>
</table>
<ul>
<li>主/从参数</li>
</ul>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>—master</td>
<td>主库模式</td>
</tr>
<tr>
<td>—slave</td>
<td>从库模式</td>
</tr>
<tr>
<td>—source arg</td>
<td>从库 端口号</td>
</tr>
<tr>
<td>—only arg</td>
<td>指定单一的数据库复制</td>
</tr>
<tr>
<td>—slavedelay arg</td>
<td>设置从库同步主库的延迟时间</td>
</tr>
</tbody>
</table>
<ul>
<li>Replica set(副本集)选项：</li>
</ul>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>—replSet arg</td>
<td>设置副本集名称</td>
</tr>
</tbody>
</table>
<ul>
<li>Sharding(分片)选项</li>
</ul>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>—configsvr</td>
<td>声明这是一个集群的config服务,默认端口27019，默认录/data/configdb</td>
</tr>
<tr>
<td>—shardsvr</td>
<td>声明这是一个集群的分片,默认端口27018</td>
</tr>
<tr>
<td>—noMoveParanoia</td>
<td>关闭偏执为moveChunk数据保存</td>
</tr>
</tbody>
</table>
<p><strong>上述参数都可以写入 mongod.conf 配置文档里</strong><br><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="setting">dbpath    = <span class="value">/data/db</span></span></span><br><span class="line"><span class="setting">logpath   = <span class="value">/data/log/mongod.log</span></span></span><br><span class="line"><span class="setting">logappend = <span class="value"><span class="keyword">true</span></span></span></span><br><span class="line"><span class="setting">port      = <span class="value"><span class="number">27017</span></span></span></span><br><span class="line"><span class="setting">fork      = <span class="value"><span class="keyword">true</span></span></span></span><br><span class="line"><span class="setting">auth      = <span class="value"><span class="keyword">true</span></span></span></span><br></pre></td></tr></table></figure></p>
<h2 id="问题处理">问题处理</h2><p>如果上次没有正确关闭mongodb，会导致存放数据的文件被锁住，只需将\data\db中的mongod.lock文件删除掉。重新启动服务即可。</p>

      
    </div>
    <footer class="article-footer">
	  
	  <!-- 百度分享 Start -->
	  <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div>
	  <!-- 百度分享 End -->
	  
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/MongoDB/">MongoDB</a></li></ul>

	  
<span>
Updated:<time datetime="2014-12-24T07:47:58.000Z" itemprop="dateModified">2014-12-24</time>
</span>


    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2014/04/29/vim-table-mode/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          vim插入表格(Vim Table Mode)
        
      </div>
    </a>
  
  
    <a href="/2014/04/20/hexo-optimize-and-my-theme-landscape-f/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">hexo优化及主题Landscape-F</div>
    </a>
  
</nav>

  
</article>



<!-- 多说评论框 start -->

<section id="comments">
  <div class="ds-thread"  data-thread-key="/2014/04/26/mongodb-note-1-install-mongodb/" data-title="mongodb笔记(一) 安装启动mongodb" data-url="http://howiefh.github.io/2014/04/26/mongodb-note-1-install-mongodb/" id="ds_thread">
    <noscript>Please enable JavaScript to view the <a href="//duoshuo.com/?ref_noscript">comments powered by duoshuo.</a></noscript>
  </div>
</section>

<!-- 多说评论框 end -->
</section>
        
          
  <div id="toc" class="toc-aside">
  <h2 class="toc-title">Contents</h2>
    
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Windows下安装"><span class="toc-number">1.</span> <span class="toc-text">Windows下安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装"><span class="toc-number">1.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#运行mongodb"><span class="toc-number">1.2.</span> <span class="toc-text">运行mongodb</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#添加mongodb为windows服务"><span class="toc-number">1.3.</span> <span class="toc-text">添加mongodb为windows服务</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux下安装"><span class="toc-number">2.</span> <span class="toc-text">Linux下安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装-1"><span class="toc-number">2.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#运行mongodb-1"><span class="toc-number">2.2.</span> <span class="toc-text">运行mongodb</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#参数"><span class="toc-number">3.</span> <span class="toc-text">参数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#问题处理"><span class="toc-number">4.</span> <span class="toc-text">问题处理</span></a></li></ol>
    
  </div>

<aside id="sidebar">

  
    
<div class="widget-wrap">
  <h3 class="widget-title">ABOUT ME</h3>
  <ul class="widget about-me">
    
    <li><img class="author" title="About me" src="http://fh-1.qiniudn.com/okal-eltocat.jpg" /></li>
    
    
    <li>Hi,I'm FengHao.</li>
    
    <li>I'll share something interesting and my learning experience with you at this blog.</li>
    
    <li>前博客:<a href="http://hi.baidu.com/idea_star" target="_BLANK">百度空间</a></li>
    
  </ul>
</div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Android/">Android</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/C/">C</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Database/">Database</a><span class="category-list-count">13</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/Database/MongoDB/">MongoDB</a><span class="category-list-count">10</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Database/MySQL/">MySQL</a><span class="category-list-count">2</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Eclipse/">Eclipse</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/FTP/">FTP</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Git/">Git</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Hexo/">Hexo</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a><span class="category-list-count">20</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/Java/FreeMarker/">FreeMarker</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Java/Shiro/">Shiro</a><span class="category-list-count">2</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaEE/">JavaEE</a><span class="category-list-count">4</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/JavaEE/Hibernate/">Hibernate</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaEE/JSP/">JSP</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaEE/Spring/">Spring</a><span class="category-list-count">2</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/">JavaScript</a><span class="category-list-count">5</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/jQuery/">jQuery</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/PHP/">PHP</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Suse/">Suse</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Ubuntu/">Ubuntu</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Vim/">Vim</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/编程/">编程</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/软件/">软件</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Android/" style="font-size: 14.75px; color: #65bfa7">Android</a> <a href="/tags/C/" style="font-size: 13.88px; color: #71c1c2">C</a> <a href="/tags/CAS/" style="font-size: 13px; color: #7dc3de">CAS</a> <a href="/tags/Chrome/" style="font-size: 13px; color: #7dc3de">Chrome</a> <a href="/tags/Clean-Code/" style="font-size: 13.88px; color: #71c1c2">Clean Code</a> <a href="/tags/Database/" style="font-size: 13px; color: #7dc3de">Database</a> <a href="/tags/Eclipse/" style="font-size: 13px; color: #7dc3de">Eclipse</a> <a href="/tags/FTP/" style="font-size: 13.88px; color: #71c1c2">FTP</a> <a href="/tags/FreeMarker/" style="font-size: 14.75px; color: #65bfa7">FreeMarker</a> <a href="/tags/Gcc/" style="font-size: 13px; color: #7dc3de">Gcc</a> <a href="/tags/Git/" style="font-size: 14.75px; color: #65bfa7">Git</a> <a href="/tags/Github-Pages/" style="font-size: 13px; color: #7dc3de">Github Pages</a> <a href="/tags/Hexo/" style="font-size: 14.75px; color: #65bfa7">Hexo</a> <a href="/tags/Hibernate/" style="font-size: 13px; color: #7dc3de">Hibernate</a> <a href="/tags/JSP/" style="font-size: 13px; color: #7dc3de">JSP</a> <a href="/tags/JVM/" style="font-size: 14.75px; color: #65bfa7">JVM</a> <a href="/tags/Java/" style="font-size: 14.75px; color: #65bfa7">Java</a> <a href="/tags/JavaMail/" style="font-size: 13px; color: #7dc3de">JavaMail</a> <a href="/tags/JavaScript/" style="font-size: 16.5px; color: #4dbc6f">JavaScript</a> <a href="/tags/Linux/" style="font-size: 13.88px; color: #71c1c2">Linux</a> <a href="/tags/Log/" style="font-size: 13px; color: #7dc3de">Log</a> <a href="/tags/Markdown/" style="font-size: 13.88px; color: #71c1c2">Markdown</a> <a href="/tags/MongoDB/" style="font-size: 20px; color: #1db400">MongoDB</a> <a href="/tags/MySQL/" style="font-size: 13.88px; color: #71c1c2">MySQL</a> <a href="/tags/PHP/" style="font-size: 16.5px; color: #4dbc6f">PHP</a> <a href="/tags/Rhythmbox/" style="font-size: 13px; color: #7dc3de">Rhythmbox</a> <a href="/tags/SSO/" style="font-size: 13px; color: #7dc3de">SSO</a> <a href="/tags/Servlet/" style="font-size: 13px; color: #7dc3de">Servlet</a> <a href="/tags/Shiro/" style="font-size: 13.88px; color: #71c1c2">Shiro</a> <a href="/tags/Spring/" style="font-size: 13.88px; color: #71c1c2">Spring</a> <a href="/tags/Suse/" style="font-size: 13px; color: #7dc3de">Suse</a> <a href="/tags/Thinking-in-Java/" style="font-size: 19.13px; color: #29b61c">Thinking in Java</a> <a href="/tags/Ubuntu/" style="font-size: 17.38px; color: #41ba53">Ubuntu</a> <a href="/tags/Vim/" style="font-size: 18.25px; color: #35b838">Vim</a> <a href="/tags/VirtualBox/" style="font-size: 13px; color: #7dc3de">VirtualBox</a> <a href="/tags/Vsftpd/" style="font-size: 13px; color: #7dc3de">Vsftpd</a> <a href="/tags/jQuery/" style="font-size: 13px; color: #7dc3de">jQuery</a> <a href="/tags/pam-mysql/" style="font-size: 13px; color: #7dc3de">pam_mysql</a> <a href="/tags/小米/" style="font-size: 13px; color: #7dc3de">小米</a> <a href="/tags/软件/" style="font-size: 15.63px; color: #59bd8b">软件</a>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/">May 2015</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/04/">April 2015</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/10/">October 2014</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">February 2014</a><span class="archive-list-count">11</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/01/">January 2014</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/12/">December 2013</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/03/">March 2012</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>


  
    <div class="widget-wrap">
  <h3 class="widget-title">Calendar</h3>
  <div class="widget">
    <div id="g-calendar" class="g-calendar">
        <span class="g-calendar-prev"></span>
		 
        <span class="g-calendar-back"></span>
        <span class="g-calendar-now"></span>
		 
        <span class="g-calendar-next"></span>
        <div class="g-calendar-hd"></div>
        <div class="g-calendar-tit"></div>
        <div class="g-calendar-bd"></div>
    </div>
  </div>
</div>
<script type="text/javascript">
function LGY_calendar(wrapId, options){
    this.oWrap = this.getId(wrapId);
    this.oHead = this.getByClassName('g-calendar-hd',this.oWrap)[0];
    this.oBody = this.getByClassName('g-calendar-bd',this.oWrap)[0];
    this.oTit = this.getByClassName('g-calendar-tit',this.oWrap)[0];
    this.oPrev = this.getByClassName('g-calendar-prev',this.oWrap)[0];
    this.oNext = this.getByClassName('g-calendar-next',this.oWrap)[0];
    this.oNow = this.getByClassName('g-calendar-now',this.oWrap)[0];
    this.oBack = this.getByClassName('g-calendar-back',this.oWrap)[0];
    this.init();
}
LGY_calendar.prototype = {
    ///////////获取ID元素
    getId:function(id){
        return document.getElementById(id);
    },
    ////////获取css类名元素
    getByClassName:function(className,parent){
        var elem = [],
            node = parent != undefined&&parent.nodeType==1?parent.getElementsByTagName('*'):document.getElementsByTagName('*'),
            p = new RegExp("(^|\\s)"+className+"(\\s|$)");
        for(var n=0,i=node.length;n<i;n++){
            if(p.test(node[n].className)){
                elem.push(node[n]);
            }
        }
        return elem;
    },
    //填充日历
    fillDate:function(year,month){
        //本月份第一天是星期几-为显示上个月的天数做铺垫
        var first_day = new Date(year,month,1).getDay(),
        //如果刚好是星期天，则空出一行（显示上个月的天数）
            first_day = first_day == 0?first_day=7:first_day;
        //本月份最后一天是几号
        var final_date = new Date(year,month+1,0).getDate(),
        //上个月的最后一天是几号
            last_date = new Date(year,month,0).getDate(),
        //剩余的格子数--即排在末尾的格子数
            surplus = 42 - first_day - final_date;
        //设置年的链接
        var yearHead = "<a href='/" + "archives/" + year + "/'>" + year + " "+ "</a>"; 
        //设置年的链接
        var monthHead = "";
        var month1 = month + 1;
        if (month1 < 10) {
            monthHead = "<a href='/" + "archives/" + year + "/" + "0" + month1 + "/'>" + " " + month1 + " " + "</a>";
        } else {
            monthHead = "<a href='/" + "archives/" + year + "/" + month1 + "/'>" + " " + month1 + " " + "</a>";
        }
        //设置表头的日历
        this.oHead.innerHTML = yearHead+'年'+monthHead+'月';
        //填充日历执行
        var html = '';
        //上个月的显示天数
        for(var i=0;i<first_day;i++){
            html+='<span class="g-calendar-grey">'+(last_date-(first_day-1)+i)+'</span>';
        }
        //本月的显示天数
        var postdate = new Date("Sat Apr 26 2014 22:26:20 GMT+0800"); 
        if (true && postdate.getFullYear() == year && postdate.getMonth() == month) { 
            html += '<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span><span>18</span><span>19</span><span><a href="/2014/04/20/hexo-optimize-and-my-theme-landscape-f/" title="hexo优化及主题Landscape-F">20</a></span><span>21</span><span>22</span><span>23</span><span>24</span><span>25</span><span><a href="/2014/04/26/mongodb-note-1-install-mongodb/" title="mongodb笔记(一) 安装启动mongodb">26</a></span><span>27</span><span>28</span><span><a href="/2014/04/29/vim-table-mode/" title="vim插入表格(Vim Table Mode)">29</a></span><span><a href="/2014/04/30/mongodb-note-2-start-mongodb/" title="mongodb笔记(二) 入门">30</a></span><span>31</span>';
        } else {
            for(var j=0;j<final_date;j++){        
                html+='<span id="d'+(j+1)+'">'+(j+1)+'</span>';
            }
        }
        //下个月的显示天数
        for(var k=0;k<surplus;k++){
            html+='<span class="g-calendar-grey">'+(k+1)+'</span>';
        }
        //fill
        this.oBody.innerHTML = html;
        // 当前状态
        if(year==this.c_year&&this.c_month==month){
            this.oBody.getElementsByTagName('span')[first_day+this.date-1].className='g-calendar-on';
        }

        // 对所有文章遍历,然后将有文章的日期加上链接,如果文章太多的话,生成页面会很大,去掉了
        
    },
    // next切换
    next:function(){
        var _that = this;
        this.oNext.onclick = function(){
            _that.month++;
            if(_that.month>11){
                _that.month = 0;
                _that.year++;
            }
            // 填充日历
            _that.fillDate(_that.year,_that.month);
        };
    },
    // back 切换
    back:function(){
        var _that = this;
        if(this.oBack != undefined) {
            this.oBack.onclick = function(){
                var postdate = new Date("Sat Apr 26 2014 22:26:20 GMT+0800"); 
                _that.year = postdate.getFullYear();
                _that.month = postdate.getMonth();
                // 填充日历
                _that.fillDate(_that.year,_that.month);
            };
        }
    },
    // now切换
    now:function(){
        var _that = this;
        if(this.oNow != undefined ) {
            this.oNow.onclick = function(){
                var nowDate = new Date(); 
                _that.year = nowDate.getFullYear();
                _that.month = nowDate.getMonth();
                // 填充日历
                _that.fillDate(_that.year,_that.month);
            };
        }
    },
    // prev切换
    prev:function(){
        var _that = this;
        this.oPrev.onclick = function(){
            _that.month--;
            if(_that.month<0){
                _that.month = 11;
                _that.year--;
            }
            // 填充日历
            _that.fillDate(_that.year,_that.month);
        };
    },
    init:function(){
        this.oTit.innerHTML = '<span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span>';
        // 获取今天的日历时间
        var now = new Date();
        this.c_year = this.year = now.getFullYear();
        this.c_month = this.month = now.getMonth();
        this.date = now.getDate();
        // 初始化--填充日历
        this.fillDate(this.year,this.month);
        //next切换
        this.next();
        //prev切换
        this.prev();
        //back 切换
        this.back();
        //now 切换
        this.now();
    }
}
new LGY_calendar('g-calendar');
</script>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2015/09/01/javascript-summary/">JavaScript 总结</a>
          </li>
        
          <li>
            <a href="/2015/08/28/javascript-oop-function-expression-and-async/">JavaScript 面向对象程序设计、函数表达式和异步编程</a>
          </li>
        
          <li>
            <a href="/2015/08/28/javascript-reference-type/">JavaScript 引用类型</a>
          </li>
        
          <li>
            <a href="/2015/08/28/javascript-grammar/">JavaScript 基本语法</a>
          </li>
        
          <li>
            <a href="/2015/08/10/java-web/">Java Web 笔记</a>
          </li>
        
      </ul>
    </div>
  </div>


  
    
<div class="widget-wrap">
  <h3 class="widget-title">Recent Comments</h3>
  <ul class="widget ds-recent-comments" data-num-items="5" data-show-avatars="0" data-show-title="1" data-show-time="1"></ul>
</div>
<!-- 需要多说的公用代码 -->


  

</aside>

        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2015 howiefh<br>
      Powered by <a href="http://zespia.tw/hexo/" target="_blank">Hexo</a> and Theme by <a href="https://github.com/howiefh/hexo-theme-landscape-f" target="_blank" title="Landscape-F">Landscape-F</a>
    </div>
  </div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<!-- 多说公共JS代码 start (一个网页只需插入一次) -->

<script type="text/javascript">
  var duoshuoQuery = {short_name:"howiefh"};
  (function() {
	var ds = document.createElement('script');
	ds.type = 'text/javascript';ds.async = true;
	ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
	ds.charset = 'UTF-8';
	(document.getElementsByTagName('head')[0] 
		|| document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
</script> 

<!-- 多说公共JS代码 end -->

<!-- 百度分享 start -->

<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":["mshare","douban","bdysc","sqq","qq","hi","baidu","huaban","youdao","sdo","mail","xg","diandian","fx","copy","print"],"bdPic":"","bdStyle":"1","bdSize":"16"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>

<!-- 百度分享 end -->

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="/js/jquery.min.js"></script>
-->
<script src="/js/jquery.min.js" type="text/javascript"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
  <script src="/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>


<div class="bottom-btn">

	<a class="icon-gotop" href="javascript:void(0)" title="返回顶部"></a>
	<script src="/js/gotop.js" type="text/javascript"></script>
	<!--
	<script src="/js/gotop.js"></script>
	-->


	<a class="icon-toc-toggle" href="javascript:void(0)" title="文章目录"></a>
	<!--
	<script src="/js/toc_aside_toggle.js"></script>
	-->

</div>
<script src="/js/toc_aside_toggle.js" type="text/javascript"></script>


<script src="/js/script.js" type="text/javascript"></script>

  </div>
</body>
</html>
